<template>
    <div id="upload_video">
        <h1>手动上传</h1>
<!--        <video controls="controls" width="100%">-->
<!--            <source src="src/renderer/assets/1.mp4" type="video/mp4">-->
<!--        </video>-->

        <el-upload
                action="#"
                list-type="picture-card"
                :auto-upload="false"
                drag
                :on-change="handleChange"
                ref="pictureUpload">
            <i slot="default" class="el-icon-plus"></i>
            <div slot="file" slot-scope="{file}">
                        <video controls="controls" style="width: 360px; height: 180px">
                            <source :src=file.url type="video/mp4">
                        </video>

            <span class="el-upload-list__item-actions">
                    <span
                            class="el-upload-list__item-preview"
                            @click="handlePictureCardPreview(file)"
                    >
                      <i class="el-icon-zoom-in"></i>
                    </span>
                    <span
                            v-if="!disabled"
                            class="el-upload-list__item-delete"
                            @click="handleDownload(file)"
                    >
                      <i class="el-icon-download"></i>
                    </span>
                    <span
                            v-if="!disabled"
                            class="el-upload-list__item-delete"
                            @click="handleRemove(file)"
                    >
                      <i class="el-icon-delete"></i>
                    </span>
                </span>
            </div>
        </el-upload>
        <el-dialog :visible.sync="dialogVisible">
            <video controls="controls" width="100%" height="100%">
                <source :src=dialogImageUrl type="video/mp4">
            </video>
        </el-dialog>
    </div>
</template>

<script>

    export default {
        name: "UploadVideo",
        data() {
            return {
                videoUrl: '',
                dialogImageUrl: '',
                dialogVisible: false,
                disabled: false,
                fileList: []
            };
        },
        methods: {
            handleRemove(file) {
                this.$refs.pictureUpload.handleRemove(file)

            },
            handlePictureCardPreview(file) {
                this.dialogImageUrl = file.url;
                this.dialogVisible = true;
            },
            handleDownload(file) {
                console.log(file);
            },
            handleChange(file, fileList) {
                console.log(file)
                this.fileList = fileList
            }
        }
    }
</script>

<style scoped>

</style>